package cn.wolfcode.crm.service.imp;

import cn.wolfcode.crm.domain.Training;
import cn.wolfcode.crm.mapper.TrainingMapper;
import cn.wolfcode.crm.service.ITrainingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TrainingServiceImpl implements ITrainingService {

    @Autowired
    private TrainingMapper trainingMapper;
    @Override
    public void saveOrUpdate(Training record) {
        if (record.getId() != null) {
            //更新操作
            trainingMapper.updateByPrimaryKey(record);
        }else {
            trainingMapper.insert(record);
        }
    }

    @Override
    public List<Training> selectAll() {
        return trainingMapper.selectAll();
    }

    @Override
    public int delete(Long id) {
        return trainingMapper.deleteByPrimaryKey(id);
    }
}
